import { defineStore } from 'pinia'
import { ref } from 'vue'
export default defineStore(
  'consult',
  () => {
    // 患者病情初始数据
    const initalValue = ref({
      illnessDesc: '',
      illnessTime: '',
      consultFlag: '',
      pictures: []
    })

    const setInitalValue = (data) => {
      Object.assign(initalValue.value, data)
    }
    // 就诊类型
    const type = ref(1) // 1找医生 2极速问诊 3开药问诊
    const setType = (newType) => (type.value = newType)

    // 极速问诊类型
    const illnessType = ref(0) // 0普通1三甲
    const setIllnessType = (newIllnessType) =>
      (illnessType.value = newIllnessType)

    // 科室id
    const depId = ref('') // 科室id
    const setDepId = (newDepId) => (depId.value = newDepId)
    // 患者id
    const patientId = ref('')
    const setPatientId = (newPatientId) => (patientId.value = newPatientId)
    return {
      initalValue,
      setInitalValue,
      type,
      setType,
      illnessType,
      setIllnessType,
      depId,
      setDepId,
      patientId,
      setPatientId
    }
  },
  {
    persist: true
  }
)
